package com.fbt.transfer.app.driver.model;

import cn.hutool.core.text.StrPool;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;

/**
 * @author tuocoo
 * @date 2025年03月24日15时17分32秒/15:17
 */
@Getter
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum BsType {

  /***
   * 推送的业务类型
   */
  PUSH_NEW_ORDER(1, "来新订单啦"),
  PUSH_ORDER_STATUS(2, "订单状态变更"),
  PUSH_ORDER_REMIND(20, "催派订单"),
  /** 派单反馈 */
  PUSH_ORDER_ASSIGN_RESULT(25, "派单反馈"),
  PUSH_ORDER_CANCEL(30, "订单取消"),
  BAD_COMMENT(50, "差评提示"),
  UNKNOWN(10000, "平台消息"),
  ;
  private final Integer value;
  private final String desc;

  BsType(Integer value, String desc) {
    this.value = value;
    this.desc = desc;
  }

  public static BsType getByValue(String value) {
    for (BsType bsType : BsType.values()) {
      if (bsType.getValue().equals(Integer.parseInt(value))) {
        return bsType;
      }
    }
    return UNKNOWN;
  }

  @Override
  public String toString() {
    return this.value + StrPool.COLON + this.desc;
  }
}
